CLI | Run Mobile Tests
DevAssure CLI enables users to configure mobile environments and execute mobile test suites efficiently via the command line.
Running mobile tests using the DevAssure CLI involves two primary steps:
Step 1: Setup the Mobile Environment
Before executing any mobile tests, set up the required mobile SDKs and dependencies. This step ensures your testing environment has all necessary components.
./DA
--auth-token eyJhbGciOiJIUzI1NiJ9.eyJjdXN0b21fdG9rZW4iOiJlZjQ3NInVzZXJfaWQiOjY2fQ \
--source '/Users/youruser/Project/' \
--target '/Users/youruser/' \
setup-mobile \
--action setup \
--os android \
--dependencies android:34:35
Parameter | Mandatory | Format / Example | Description |
---|---|---|---|
--auth-token | Yes | <YOUR_DEVASSURE_TOKEN> | Your authentication token for DevAssure. This is crucial for all CLI operations. Replace the example token with your actual token, which can be generated from web app . |
--source | Yes | '/Users/youruser/myproject/' | Specifies the base path of your project where DevAssure will look for test files. |
--target | Yes | '/Users/youruser/output/' | Defines the output directory where DevAssure will generate logs, reports, and other results. |
--action | Yes | setup | Use setup to initialize required dependencies for the mobile testing environment. |
--os | Yes | android , ios , or all | Specifies the platform(s) to configure for mobile testing. |
--dependencies | Yes | android:34:35 | Defines the required SDK versions to install for the selected platform(s). Format: <platform>:<sdk_ver1>:<sdk_ver2>:... |
The above example command installs both Android SDK 34 and Android SDK 35 during the setup process.
Multiple Versions: You can specify multiple SDK versions by separating them with colons (:).
Platform Support: Currently, only Android is supported for SDK versioning using the --dependencies parameter.
Required Android SDK Version: One or more Android SDK version must be specified for Android automation (e.g., 30, 31, 34, 35).
SDK Version | Android OS Version |
---|---|
30 | Android 11 |
31 | Android 12 |
32 | Android 12L |
33 | Android 13 |
34 | Android 14 |
35 | Android 15 (Preview) |
Step 2: Run the Mobile Tests
After setting up your mobile testing environment, you can execute your test suites using the run
command.
DevAssure supports two primary methods for running tests:
- using local application builds (or)
- pre-uploaded applications in the device cloud.
Option | Description |
---|---|
--mobile-build-folder | Specifies the directory path to your local mobile build (e.g., APK/IPA file). When using this option, the application will be automatically uploaded to the Device cloud as part of the execution. |
--mobile-cloud-app-versions | Use this to run tests with applications that are already uploaded and available in the DevAssure cloud. Format: AppName:version. You can specify multiple applications by separating them with commas (e.g., saucedemo:2.7.1,saucedemo:2.7.5,feedly:2.8). |
Run with Local Build Folder
Use this approach if you are referring to a mobile application located on your local system.
./DA
--auth-token <DEVASSURE-TOKEN> \
--source '/Users/youruser/Project/' \
--target '/Users/youruser/' \
run \
--mobile-build-folder '/Users/youruser/mobileapp/' \
--suite '/Users/youruser/Project/test-suite/ss.suite.tspp' \
--job-name 'mobile' \
--run-profile "/Users/youruser/Project/run-profile/test.profile.tspp"
Run with Device cloud
Use this option if your app is already uploaded and available in the Device cloud.
./DA
--auth-token <DEVASSURE-TOKEN> \
--source '/Users/youruser/Project/' \
--target '/Users/youruser/' \
run \
--mobile-cloud-app-versions saucedemo:2.7.1 \
--suite '/Users/youruser/Project/test-suite/mobile.suite.tspp' \
--job-name 'mobile' \
--run-profile "/Users/youruser/Project/run-profile/test.profile.tspp"
The --suite
parameter points to your test suite definition file (.suite.tspp), which specifies the tests to be executed.
The --run-profile
parameter points to your run profile file (.profile.tspp), which defines additional test run parameters like device allocation and emulator configurations.
Running Mobile tests with CI Pipelines
When setting up DevAssure CLI in a Continuous Integration (CI) pipeline for mobile test execution, consider the following guidelines to ensure efficient and reliable runs:
CI Pipeline Stages
Step 1: Environment Setup
- Use the
setup-mobile --action setup
command to install required SDKs and tools. This step is mandatory before running any tests.
Step 2: Test Execution
- Use the run command with either
--mobile-build-folder
(to use a local build) or--mobile-cloud-app-versions (for device cloud apps)
.
Persistent CI Agents: If your CI agent (slave VM) is persistently running, you only need to execute the setup-mobile command once. Subsequent test runs can directly proceed to Stage 2.
Emulator Handling in CI
If your tests require emulators, you can configure DevAssure to dynamically create emulators during CI runs using settings within your .profile.tspp
run profile. This allows for flexible test environments without manual setup.
⚠️ Resource Consumption: Emulators consume significant RAM and CPU resources. Even on high-performance machines, it is recommended to run a maximum of two emulators concurrently to avoid performance bottlenecks.